function a(a, e, t) {
    return e in a ? Object.defineProperty(a, e, {
        value: t,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[e] = t, a;
}

var e, t = require("../export.js"), n = (getApp(), require("../../../wxParse/wxParse.js"));

Page({
    data: (e = {
        current: 0,
        options: {},
        Carinfo: [],
        shareInfo: {}
    }, a(e, "options", 0), a(e, "zan", !1), e),
    onLoad: function(a) {
        var e = this;
        this.setData({
            options: a
        }), console.log(a), this.getCarInfo(a), this.getConfigInfo(a), t.dg.hideShareMenu();
        var n = t.API_HOST + "/index.php/addon/DuoguanUser/Api/getShareInfo.html";
        t.request.get(n, {
            mmodule: "duoguanCar"
        }, function(a) {
            e.setData({
                shareInfo: a
            }), t.dg.showShareMenu();
        }, this, {
            isShowLoading: !1
        });
    },
    onPullDownRefresh: function() {
        this.asPullDownRefresh();
    },
    onShareAppMessage: function(a) {
        console.log(a);
        var e = this.data.options, t = this.data.shareInfo.title || "汽车详情", n = "/pages/car/detail/detail";
        return "button" == a.from && (n = "/pages/car/detail/detail?id=" + e.id), {
            title: t,
            path: n
        };
    },
    ToUrl: function(a) {
        var e = a.currentTarget.dataset.url;
        wx.navigateTo({
            url: "../webview/webview?url=" + e
        });
    },
    getcurrent: function(a) {
        var e = a.detail.current;
        this.setData({
            current: e
        });
    },
    asPullDownRefresh: function() {
        var a = this.data.options;
        this.getCarInfo(a), this.getConfigInfo(a), t.dg.stopPullDownRefresh();
    },
    getCarInfo: function(a) {
        var e = this;
        t.requestUtil.post(t._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getCarInfo.html", a, function(a) {
            n.wxParse("description", "html", a.content, e), e.setData({
                Carinfo: a,
                zan: a.zan
            });
        });
    },
    getConfigInfo: function(a) {
        var e = this;
        t.requestUtil.post(t._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getConfigInfo.html", a, function(a) {
            e.setData({
                ConfigInfo: a
            });
        });
    },
    getbuy: function(a) {
        var e = this, n = {
            id: a.currentTarget.dataset.id
        };
        t.requestUtil.post(t._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Apiform/getbuy.html", n, function(a) {
            e.setData({
                zan: !e.data.zan
            });
        });
    },
    goZhanting: function(a) {
        console.log(a);
        var e = a.currentTarget.dataset.car_goods_id;
        t.dg.navigateTo({
            url: "/pages/car/select-type/select-type?id=" + e + "&flag=1"
        });
    },
    callPhone: function(a) {
        var e = a.currentTarget.dataset.mobile;
        wx.makePhoneCall({
            phoneNumber: e
        });
    },
    goPeizhi: function(a) {
        var e = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/pages/car/configure/configure?id=" + e
        });
    },
    goXunJia: function(a) {
        var e = a.currentTarget.dataset.car_goods_id, t = a.currentTarget.dataset.car_goods_level_id;
        wx.navigateTo({
            url: "/pages/car/bespeak/bespeak?car_goods_id=" + e + "&car_goods_level_id=" + t
        });
    },
    goShiJia: function(a) {
        var e = a.currentTarget.dataset.car_goods_id, t = a.currentTarget.dataset.car_goods_level_id;
        wx.navigateTo({
            url: "/pages/car/bespeak-shijia/bespeak-shijia?car_goods_id=" + e + "&car_goods_level_id=" + t
        });
    }
});